//
// Created by 31897 on 2021/11/5.
//

#include <iostream>
#include <vector>
using namespace std;

vector<vector<int>> price;
vector<vector<int>> minprice;

int main(){
    int n;
    cin >> n;
    price.resize(n);
    for (int i = 0; i < n; ++i) {
        price[i].resize(n);
        for (int j = 0; j < n-i; ++j) {
            if(j==0){
                price[i][j]=0;
            }
            else
                cin >> price[i][j];
        }
    }
    minprice = price;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j < n-i; ++j) {
            int min = 2147483647;
            for (int k = 0; k <= j; ++k) {
                if(minprice[i][k]+minprice[i+k][j-k]<min){
                    min = minprice[i][k]+minprice[i+k][j-k];
                }
            }
            minprice[i][j]=min;
        }
    }
    cout << minprice[0][n-1];
    return 0;
}